import request from '@/utils/request'

// 随机获取视频
export function videoRandom() {
    return request.get({
        url: '/admin/m/video/random',
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 分页查询视频
export function videoPage(data: Record<string, any>) {
    return request.get({
        url: '/admin/m/video/page',
        data,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 关注店铺-用户的视频
export function videoFollowing(data: Record<string, any>) {
    return request.get({
        url: '/admin/m/video/following',
        data,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 视频详情
export function videoDetail(id: string) {
    return request.get({
        url: `/admin/m/video/detail/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 播放视频
export function videoPlay(id: string) {
    return request.post({
        url: `/admin/m/video/play/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 分享视频
export function videoShare(id: string) {
    return request.post({
        url: `/admin/m/video/share/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 点赞视频
export function videoLike(id: string) {
    return request.post({
        url: `/admin/m/video/like/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 收藏视频
export function videoCollect(id: string) {
    return request.post({
        url: `/admin/m/video/collect/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 关注店铺
export function shopFollow(id: string) {
    return request.post({
        url: `/admin/m/shop/${id}/follow`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 分页查询评论
export function commentPage(data: Record<string, any>) {
    return request.get({
        url: '/admin/m/videoComment/comment/page',
        data,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 发布视频评论
export function commentSave(data: Record<string, any>) {
    return request.post({
        url: '/admin/m/videoComment/comment/save',
        data
    })
}

// 点赞评论
export function commentLike(id: string) {
    return request.post({
        url: `/admin/m/videoComment/like/${id}`,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 分页查询
export function shopPage(data: Record<string, any>) {
    return request.get({
        url: '/admin/m/shop/page',
        data,
        header: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 视频详情
// /admin/m/video/{id}

export const videoDetailApi = (id: string) => {
    return request.get({
        url: `/admin/m/video/${id}`
    })
}
